@burstjs/util
Useful utilities and tools for building Burstcoin applications
Installation
Install using npm:
npm install @burstjs/util
or using yarn:
yarn add @burstjs/util
API Reference
Constants
- burstAddressPattern
A useful regex for matching burst addresses
Functions
- constructBurstAddress(parts)
Construct a Burst address from a string array
- convertNumberToString(n) ⇒
Helper method to Number to String(8 decimals) representation
- convertStringToNumber(amount) ⇒
Helper method to convert a String to number
- decode(address)
Decode BURST-XXXX-XXXX-XXXX-XXXXX into numeric Id
- encode(numericId)
Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX
- isBurstAddress(address)
Validation Check. Quick validation of Burst addresses included
- isValid(address)
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
- splitBurstAddress(address)
Split the Burst address string into an array of 4 parts
burstAddressPattern
A useful regex for matching burst addresses
Kind: global constant
constructBurstAddress(parts)
Construct a Burst address from a string array
Kind: global function
Param | Description |
---|
parts | 4 parts string array |
convertNumberToString(n) ⇒
Helper method to Number to String(8 decimals) representation
Kind: global function
Returns:
a NQT number string
Param | Description |
---|
n | the number |
convertStringToNumber(amount) ⇒
Helper method to convert a String to number
Kind: global function
Returns:
A number expressed in Burst (not NQT)
Param | Description |
---|
amount | The amount in NQT |
decode(address)
Decode BURST-XXXX-XXXX-XXXX-XXXXX into numeric Id
Kind: global function
Param | Description |
---|
address | The BURST address |
encode(numericId)
Encode a numeric id into BURST-XXXX-XXXX-XXXX-XXXXX
Kind: global function
Param | Description |
---|
numericId | The numeric Id |
isBurstAddress(address)
Validation Check. Quick validation of Burst addresses included
Kind: global function
Param | Description |
---|
address | Burst Address |
isValid(address)
Check for valid Burst address (format: BURST-XXXX-XXXX-XXXX-XXXXX, XXXX-XXXX-XXXX-XXXXX)
Kind: global function
Param | Description |
---|
address | The address |
splitBurstAddress(address)
Split the Burst address string into an array of 4 parts
Kind: global function
Param | Description |
---|
address | A valid Burst address |